package institutional

class Department {
	String name
	int code
	
	static hasMany = [subjects: Subject]
	
    static constraints = {
		code: unique: true
		name(blank: false, unique: true)
    }
	
	String toString () {
		"$code. $name"
	}
	
	public Set allSubjects () {
		return subjects.findAll()
	}
	
	
}
